// 加载mysql模块
const mysql = require("mysql")
const pool = mysql.createPool({
  connectionLimit:20,
  host:'localhost',
  user:'root',
  password:'',
  database:'chunyouji'
})

pool.querySync = (sql,params)=>{
  return new Promise((resolve,reject)=>{
    pool.query(sql,params,(error,result)=>{
      if(error){
        reject(error)
      }else{
        resolve(result)
      }
    })
  })
}

module.exports = pool